import { Injectable , NestMiddleware} from '@nestjs/common'
import { Request, Response, NextFunction } from 'express'

// 提供者
import { AppService } from './app.service'

@Injectable()
export class LoggerMiddleware implements NestMiddleware {

  constructor(
    private readonly appService: AppService
  ) {}

  use(req: Request, res: Response, next: NextFunction) {
    console.log('LoggerMiddleware')
    this.appService.log()
    next()
  }

}
